home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / ColorSync 3.0 Mac SDK / Interfaces / CMCalibrator.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-28  |  7.9 KB  |  211 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CMCalibrator.h
  3.  
  4.      Contains:    ColorSync Calibration API
  5.  
  6.      Version:    Technology:    ColorSync 2.5
  7.                  Release:    ColorSync 3.0 SDK for use with Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1998-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CMCALIBRATOR__
  18. #define __CMCALIBRATOR__
  19.  
  20. #ifndef __CMAPPLICATION__
  21. #include <CMApplication.h>
  22. #endif
  23.  
  24. #ifndef __DISPLAYS__
  25. #include <Displays.h>
  26. #endif
  27.  
  28. #ifndef __ERRORS__
  29. #include <Errors.h>
  30. #endif
  31.  
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. typedef CALLBACK_API( void , CalibrateEventProcPtr )(EventRecord *event);
  56. typedef STACK_UPP_TYPE(CalibrateEventProcPtr)                     CalibrateEventUPP;
  57.  
  58. /* Interface for new ColorSync monitor calibrators (ColorSync 2.6 and greater) */
  59.  
  60. enum {
  61.     kCalibratorNamePrefix        = FOUR_CHAR_CODE('cali')
  62. };
  63.  
  64.  
  65. struct CalibratorInfo {
  66.     UInt32                             dataSize;                    /* Size of this structure - compatibility */
  67.     AVIDType                         displayID;                    /* Contains an hDC on Win32 */
  68.     UInt32                             profileLocationSize;        /* Max size for returned profile location */
  69.     CMProfileLocation *                profileLocationPtr;            /* For returning the profile */
  70.     CalibrateEventUPP                 eventProc;                    /* Ignored on Win32 */
  71.     Boolean                         isGood;                        /* true or false */
  72. };
  73. typedef struct CalibratorInfo            CalibratorInfo;
  74. typedef CALLBACK_API( Boolean , CanCalibrateProcPtr )(AVIDType displayID, Str255 errMessage);
  75. typedef CALLBACK_API( OSErr , CalibrateProcPtr )(CalibratorInfo *theInfo);
  76. typedef STACK_UPP_TYPE(CanCalibrateProcPtr)                     CanCalibrateUPP;
  77. typedef STACK_UPP_TYPE(CalibrateProcPtr)                         CalibrateUPP;
  78. #if OPAQUE_UPP_TYPES
  79.     EXTERN_API(CalibrateEventUPP)
  80.     NewCalibrateEventUPP           (CalibrateEventProcPtr    userRoutine);
  81.  
  82.     EXTERN_API(CanCalibrateUPP)
  83.     NewCanCalibrateUPP               (CanCalibrateProcPtr        userRoutine);
  84.  
  85.     EXTERN_API(CalibrateUPP)
  86.     NewCalibrateUPP                   (CalibrateProcPtr        userRoutine);
  87.  
  88.     EXTERN_API(void)
  89.     DisposeCalibrateEventUPP       (CalibrateEventUPP        userUPP);
  90.  
  91.     EXTERN_API(void)
  92.     DisposeCanCalibrateUPP           (CanCalibrateUPP            userUPP);
  93.  
  94.     EXTERN_API(void)
  95.     DisposeCalibrateUPP               (CalibrateUPP            userUPP);
  96.  
  97.     EXTERN_API(void)
  98.     InvokeCalibrateEventUPP           (EventRecord *            event,
  99.                                     CalibrateEventUPP        userUPP);
  100.  
  101.     EXTERN_API(Boolean)
  102.     InvokeCanCalibrateUPP           (AVIDType                displayID,
  103.                                     Str255                    errMessage,
  104.                                     CanCalibrateUPP            userUPP);
  105.  
  106.     EXTERN_API(OSErr)
  107.     InvokeCalibrateUPP               (CalibratorInfo *        theInfo,
  108.                                     CalibrateUPP            userUPP);
  109.  
  110. #else
  111.     enum { uppCalibrateEventProcInfo = 0x000000C0 };                 /* pascal no_return_value Func(4_bytes) */
  112.     enum { uppCanCalibrateProcInfo = 0x000003D0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes) */
  113.     enum { uppCalibrateProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  114.     #define NewCalibrateEventUPP(userRoutine)                         (CalibrateEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalibrateEventProcInfo, GetCurrentArchitecture())
  115.     #define NewCanCalibrateUPP(userRoutine)                         (CanCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCanCalibrateProcInfo, GetCurrentArchitecture())
  116.     #define NewCalibrateUPP(userRoutine)                             (CalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalibrateProcInfo, GetCurrentArchitecture())
  117.     #define DisposeCalibrateEventUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  118.     #define DisposeCanCalibrateUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  119.     #define DisposeCalibrateUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  120.     #define InvokeCalibrateEventUPP(event, userUPP)                 CALL_ONE_PARAMETER_UPP((userUPP), uppCalibrateEventProcInfo, (event))
  121.     #define InvokeCanCalibrateUPP(displayID, errMessage, userUPP)     (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppCanCalibrateProcInfo, (displayID), (errMessage))
  122.     #define InvokeCalibrateUPP(theInfo, userUPP)                     (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppCalibrateProcInfo, (theInfo))
  123. #endif
  124. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  125. #define NewCalibrateEventProc(userRoutine)                         NewCalibrateEventUPP(userRoutine)
  126. #define NewCanCalibrateProc(userRoutine)                         NewCanCalibrateUPP(userRoutine)
  127. #define NewCalibrateProc(userRoutine)                             NewCalibrateUPP(userRoutine)
  128. #define CallCalibrateEventProc(userRoutine, event)                InvokeCalibrateEventUPP(event, userRoutine)
  129. #define CallCanCalibrateProc(userRoutine, displayID, errMessage) InvokeCanCalibrateUPP(displayID, errMessage, userRoutine)
  130. #define CallCalibrateProc(userRoutine, theInfo)                    InvokeCalibrateUPP(theInfo, userRoutine)
  131. #if OLDROUTINENAMES
  132. /* Interface for original ColorSync monitor calibrators (ColorSync 2.5.x) */
  133. enum {
  134.     kOldCalibratorNamePrefix    = FOUR_CHAR_CODE('Cali')
  135. };
  136.  
  137.  
  138. struct OldCalibratorInfo {
  139.     AVIDType                         displayID;                    /* Contains an hDC on Win32 */
  140.     CMProfileLocation                 profileLocation;
  141.     CalibrateEventUPP                 eventProc;                    /* Ignored on Win32 */
  142.     UInt32                             reserved;                    /* Unused */
  143.     UInt32                             flags;                        /* Unused */
  144.     Boolean                         isGood;                        /* true or false */
  145.     SInt8                             byteFiller;                    /* Unused */
  146. };
  147. typedef struct OldCalibratorInfo        OldCalibratorInfo;
  148. typedef CALLBACK_API( Boolean , OldCanCalibrateProcPtr )(AVIDType displayID);
  149. typedef CALLBACK_API( OSErr , OldCalibrateProcPtr )(OldCalibratorInfo *theInfo);
  150. typedef STACK_UPP_TYPE(OldCanCalibrateProcPtr)                     OldCanCalibrateUPP;
  151. typedef STACK_UPP_TYPE(OldCalibrateProcPtr)                     OldCalibrateUPP;
  152. #if OPAQUE_UPP_TYPES
  153.     EXTERN_API(OldCanCalibrateUPP)
  154.     NewOldCanCalibrateUPP           (OldCanCalibrateProcPtr    userRoutine);
  155.  
  156.     EXTERN_API(OldCalibrateUPP)
  157.     NewOldCalibrateUPP               (OldCalibrateProcPtr        userRoutine);
  158.  
  159.     EXTERN_API(void)
  160.     DisposeOldCanCalibrateUPP       (OldCanCalibrateUPP        userUPP);
  161.  
  162.     EXTERN_API(void)
  163.     DisposeOldCalibrateUPP           (OldCalibrateUPP            userUPP);
  164.  
  165.     EXTERN_API(Boolean)
  166.     InvokeOldCanCalibrateUPP       (AVIDType                displayID,
  167.                                     OldCanCalibrateUPP        userUPP);
  168.  
  169.     EXTERN_API(OSErr)
  170.     InvokeOldCalibrateUPP           (OldCalibratorInfo *        theInfo,
  171.                                     OldCalibrateUPP            userUPP);
  172.  
  173. #else
  174.     enum { uppOldCanCalibrateProcInfo = 0x000000D0 };                 /* pascal 1_byte Func(4_bytes) */
  175.     enum { uppOldCalibrateProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  176.     #define NewOldCanCalibrateUPP(userRoutine)                         (OldCanCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOldCanCalibrateProcInfo, GetCurrentArchitecture())
  177.     #define NewOldCalibrateUPP(userRoutine)                         (OldCalibrateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOldCalibrateProcInfo, GetCurrentArchitecture())
  178.     #define DisposeOldCanCalibrateUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  179.     #define DisposeOldCalibrateUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  180.     #define InvokeOldCanCalibrateUPP(displayID, userUPP)             (Boolean)CALL_ONE_PARAMETER_UPP((userUPP), uppOldCanCalibrateProcInfo, (displayID))
  181.     #define InvokeOldCalibrateUPP(theInfo, userUPP)                 (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppOldCalibrateProcInfo, (theInfo))
  182. #endif
  183. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  184. #define NewOldCanCalibrateProc(userRoutine)                     NewOldCanCalibrateUPP(userRoutine)
  185. #define NewOldCalibrateProc(userRoutine)                         NewOldCalibrateUPP(userRoutine)
  186. #define CallOldCanCalibrateProc(userRoutine, displayID)            InvokeOldCanCalibrateUPP(displayID, userRoutine)
  187. #define CallOldCalibrateProc(userRoutine, theInfo)                InvokeOldCalibrateUPP(theInfo, userRoutine)
  188. #endif  /* OLDROUTINENAMES */
  189.  
  190.  
  191. #if PRAGMA_STRUCT_ALIGN
  192.     #pragma options align=reset
  193. #elif PRAGMA_STRUCT_PACKPUSH
  194.     #pragma pack(pop)
  195. #elif PRAGMA_STRUCT_PACK
  196.     #pragma pack()
  197. #endif
  198.  
  199. #ifdef PRAGMA_IMPORT_OFF
  200. #pragma import off
  201. #elif PRAGMA_IMPORT
  202. #pragma import reset
  203. #endif
  204.  
  205. #ifdef __cplusplus
  206. }
  207. #endif
  208.  
  209. #endif /* __CMCALIBRATOR__ */
  210.  
  211.